import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import * as _ from 'lodash';
import styles from './News.css'
import { Card } from 'antd';
const { Meta } = Card;

const oneImg = require('../assets/yay.jpg')

const new02Img = require('../assets/news/zixun02.png')
const new07Img = require('../assets/news/zixun07.png')
const new08Img = require('../assets/news/zixun08.jpg')

export default class extends PureComponent {
  static propTypes = {
    datas: PropTypes.any
  }
  static defaultProps = {
    datas: [{
      image: new02Img,
      title: "娄底首个国家级区块链研究与应用试验区落地万宝新区",
      brief: "3月7日，由湖南智慧政务区块链制定的“区块链四网互通应用场景方案通报会”在娄底市地方税务局召开。",
      href: 'https://www.shareslink.com/infor_detail2.html'
    },{
      image: new07Img,
      title: "\"区块链\"为何与娄底一拍即合?",
      brief: "\"区块链\"是什么?今年全国“两会”期间，区块链成为热议的焦点。",
      href: 'https://www.shareslink.com/infor_detail7.html'
    },{
      image: new08Img,
      title: "航天华世金股链强强联手，共建产业链供应链新生态",
      brief: "2017年10月，国务院办公厅发布了《关于积极推进供应链创新与应用的指导意见》",
      href: 'https://www.shareslink.com/infor_detail8.html'
    }]
  }
  renderCell (v, i) {
    return (
      <div onClick={() => { window.open(v.href,"_blank") }} key={i} className={styles.newsCell}>
        <img className={styles.newsCellImage} src={v.image} />
        <div className={styles.newsCellTitle}>{v.title}</div>
        <p className={styles.newsCellContent}>{v.brief}</p>
      </div>
    )
  }

  render() {
    const { datas } = this.props;
    console.log('datas is ', datas)
    return (
      <div className={styles.newsContainer}>
        {
          _.map(datas, (v, i) => {
            return (
              this.renderCell(v, i)
            )
          })
        }
      </div>
    )
  }
}
